home *** CD-ROM | disk | FTP | other *** search
/ PC Advisor 2011 May / PC Advisor 190 E.iso / pc / ESSENTIALS / VLC Media Player 1.1 / vlc-1.1.5-win32.exe / lua / intf / dumpmeta.lua < prev    next >
Encoding:
Text File  |  2010-11-13  |  2.1 KB  |  62 lines

  1. --[==========================================================================[
  2. dumpmeta.lua: dump a file's meta data on stdout/stderr
  3. --[==========================================================================[
  4.  Copyright (C) 2010 the VideoLAN team
  5.  $Id$
  6.  
  7.  Authors: Antoine Cellerier <dionoea at videolan dot org>
  8.  
  9.  This program is free software; you can redistribute it and/or modify
  10.  it under the terms of the GNU General Public License as published by
  11.  the Free Software Foundation; either version 2 of the License, or
  12.  (at your option) any later version.
  13.  
  14.  This program is distributed in the hope that it will be useful,
  15.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  GNU General Public License for more details.
  18.  
  19.  You should have received a copy of the GNU General Public License
  20.  along with this program; if not, write to the Free Software
  21.  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  22. --]==========================================================================]
  23.  
  24. --[[ to dump meta data information in the debug output, run:
  25.        vlc -I lua --lua-intf dumpmeta coolmusic.mp3
  26.      Additional options can improve performance and output readability:
  27.        -V dummy -A dummy --no-video-title --no-media-library --verbose-objects +lua,-all -v=0
  28. --]]
  29.  
  30. local item
  31. repeat
  32.     item = vlc.input.item()
  33. until (item and item:is_preparsed()) or vlc.misc.should_die()
  34.  
  35. -- preparsing doesn't always provide all the information we want (like duration)
  36. repeat
  37. until item:stats()["demux_read_bytes"] > 0 or vlc.misc.should_die()
  38.  
  39. vlc.msg.info("name: "..item:name())
  40. vlc.msg.info("uri: "..vlc.strings.decode_uri(item:uri()))
  41. vlc.msg.info("duration: "..tostring(item:duration()))
  42.  
  43. vlc.msg.info("meta data:")
  44. local meta = item:metas()
  45. if meta then
  46.     for key, value in pairs(meta) do
  47.         vlc.msg.info("  "..key..": "..value)
  48.     end
  49. else
  50.     vlc.msg.info("  no meta data available")
  51. end
  52.  
  53. vlc.msg.info("info:")
  54. for cat, data in pairs(item:info()) do
  55.     vlc.msg.info("  "..cat)
  56.     for key, value in pairs(data) do
  57.         vlc.msg.info("    "..key..": "..value)
  58.     end
  59. end
  60.  
  61. vlc.misc.quit()
  62.